﻿@model YSC_Core.BLL.Domain.Entity.NewsArticle
@{
    ViewData["Title"] = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section Scripts
    {

    <script type="text/javascript">
        var selfLayer = null, page = 1, active = null;
        layui.use(['layer', 'table', 'laydate', 'form'], function () {
            var form = layui.form;
            //   picker.GetTypeDictionaryList(layui.form, { type: "鱼种" }, $("#typeId").val());
            //监听提交
            form.on('submit(submit)', function (data) {

                axios.get('/NewsArticle/AddEditSubmit', {
                    params: {
                        paramete: data.field,
                    }
                }).then(function (response) {
                    console.log(response);
                    if (response.data.Code == 200) {
                        javascript: history.go(-1);
                    } else {
                        alert(response.msg)
                    }

                }).catch(function (error) {
                    console.log(error);
                });

                console.log(data);
                return false;
            });


        });
    </script>
}
    <script src="~/js/jquery-1.11.1.min.js"></script>
<script src="~/lib/ueditor/ueditor.config.js"></script>
<script src="~/lib/ueditor/ueditor.all.js"></script>
<script src="~/lib/ueditor/lang/zh-cn/zh-cn.js"></script>
<form class="layui-form layui-form-pane" asp-action="Edit">
    <input type="hidden" id="typeId" name="typeId" asp-for="Type" />
    <div class="layui-form-item">
        <label class="layui-form-label">文章类型</label>
        <div class="layui-input-inline">
            <select lay-search="" autocomplete="off" lay-verify="required" asp-for="Type">
                <option value="">请选择</option>
                <option value="新闻动态">新闻动态</option>
                <option value="市场报告">市场报告</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input w_545" autocomplete="off" lay-verify="required" asp-for="Title">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
            @*<input type="text" class="layui-input w_545" autocomplete="off" lay-verify="required" asp-for="Details">*@
            <script id="editor" type="text/plain" name="Details" style="width:543px;height:300px;float:left;">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea asp-for="Remarks" style="width:545px;height:100px"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input class="layui-btn" type="button" style="width: 100px" lay-submit lay-filter="submit" value="立即提交" />
            <button type="reset" style="width: 100px" class="layui-btn layui-btn-primary">重置</button>
            <a style="width: 100px" class="layui-btn layui-btn-primary backIframe" asp-action="Index">返回</a>
        </div>
    </div>
    <input type="hidden" asp-for="Id" />
    <input type="hidden" id="daily_content" name="daily_content" asp-for="Details" />
</form>

<script type="text/javascript">

    var ue = UE.getEditor('editor');
    $(function () {
        window.setTimeout(setContent, 1000);//一秒后再调用赋值方法
    });
    //给ueditor插入值
    function setContent() {
        var content = $("#daily_content").val();
        ue.ready(function () {//编辑器初始化完成再赋值
            ue.setContent(content);  //赋值给UEditor
        });
    }
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#ReleaseTime' //指定元素
        });
    });
</script>

